﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="BeachesByTag.aspx.vb" Inherits="BeachesInGreeceComplete.BeachesByTag" %>
<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div class="aside2">
         <br />
        <h3>
            Search</h3>
        <br />
        <br />
        <asp:TextBox ID="tb_search" runat="server" />
        <br />
        
        <table>
        <tr>
        <td><asp:Button ID="btn_findByName" runat="server" Text="By Name" CssClass="m-btn blue" /></td>
        <td><asp:Button ID="btn_findByRegion" runat="server" Text="By Region" CssClass="m-btn blue" /></td>
        </tr>
        </table>
        <br />
        <h3>Charts</h3>
        <br />
        <br />
    <asp:Chart ID="Chart3" runat="server" DataSourceID="SqlDataSource1" Height="200px" Width="200px">
        <series>
            <asp:Series Name="Series1" XValueMember="BeachName" YValueMembers="TotalTags">
            </asp:Series>
        </series>
        <chartareas>
            <asp:ChartArea Name="ChartArea1">
            </asp:ChartArea>
        </chartareas>
    </asp:Chart>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM [BeachesPerTag] WHERE ([Tag] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="Tag" QueryStringField="Tag" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
        </div>

<h2 id="myHeading" runat="server"> </h2>
 <div class="mainDiv2">
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID"
            DataSourceID="SqlDataSource2">
            <ItemTemplate>
                <li class="hoverClass">
                    <asp:Label ID="lbl_Name" CssClass="BeachNameLabel" runat="server" Text='<%# Eval("BeachName") %>' />
                    <br />
                    <asp:Label ID="lbl_Region" CssClass="RegionLabel" runat="server" Text='<%# Eval("Region") %>' />
                    <br />
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID", "BeachDetails.aspx?ID={0}") %>'>
                        <img src='<%# Eval("Thumbnail") %>'  alt="No picture found"  width="100" height="100" style="border-style: solid; border-width: medium" />
                    </asp:HyperLink>
                    <br />
                    <asp:Label ID="lbl_Time" runat="server" Text='<%# CalculateTime.calculateTimeNoHours(Eval("DateAdded")) %>' ForeColor="#009999" />
                     • <span id="Span1"  runat="server" title='<%# getViews(Eval("ID")) + " Views" %>'><asp:Label ID="Label1" runat="server" Text='<%# getViews(Eval("ID")) %>'  CssClass="myButton" /></span>
                    <br />                            
                    By •
                    <asp:HyperLink ID="HyperLink2" runat="server" Text='<%# Eval("Tourist")%>' NavigateUrl='<%# Eval("Tourist", "Profile.aspx?Tourist={0}") %>'
                        ForeColor="Red" Font-Bold="True" CssClass="red" Font-Size="Smaller">
                        <asp:Label ID="TouristLabel" CssClass="BeachNameLabel" runat="server" Text='<%# Eval("Tourist") %>' />
                    </asp:HyperLink><br /></li></ItemTemplate><LayoutTemplate>
                <ul class="ItemContainer">
                    <li runat="server" id="itemPlaceholder" />
                </ul>
            </LayoutTemplate>
        </asp:ListView>
     <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" 
        
        SelectCommand="SELECT DISTINCT * FROM [BeachTagView] WHERE ([Tag] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="Tag" QueryStringField="Tag" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:DataPager ID="DataPagerBeaches" runat="server" PagedControlID="ListView1" PageSize="8">
                <Fields>
                    <asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False"
                        ButtonType="Link" ButtonCssClass="buttonDataPage" />
                    <asp:NumericPagerField ButtonType="Link"/>
                    <asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False"
                        ButtonType="Link" ButtonCssClass="buttonDataPage" />
                </Fields>
            </asp:DataPager>
    </div>
</asp:Content>
